build: Make all X11 extensions mandatory
authorBenjamin Otte <otte@redhat.com>
Fri, 2 Apr 2021 00:13:49 +0000 (02:13 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 20 Jul 2021 18:00:25 +0000 (14:00 -0400)
It's not 2011 anymore, and we shouldn't randomly build one of 10.000
different combinations of X11 backends (I counted the possibilities) but
exactly the one we expect people to use.

meson.build
meson_options.txt

index 10665b855daea011f2b93315288b0eec8f3c249d..f3e4fa1a2ac47360bff107f0797a5ca60c15992f 100644 (file)
@@ -497,46 +497,36 @@ if x11_enabled
   xrender_dep    = dependency('xrender')
   xi_dep         = dependency('xi')
   xext_dep       = dependency('xext')
-  xcursor_dep    = dependency('xcursor', required: false)
-  xdamage_dep    = dependency('xdamage', required: false)
-  xfixes_dep     = dependency('xfixes', required: false)
-  xcomposite_dep = dependency('xcomposite', required: false)
+  xcursor_dep    = dependency('xcursor')
+  xdamage_dep    = dependency('xdamage')
+  xfixes_dep     = dependency('xfixes')
+  xcomposite_dep = dependency('xcomposite')
   fontconfig_dep = dependency('fontconfig')
 
-  x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr']
+  x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr', 'xcursor', 'xdamage', 'xfixes', 'xcomposite', 'xinerama']
 
-  if xcursor_dep.found()
-    x11_pkgs += ['xcursor']
-  endif
-  if xdamage_dep.found()
-    x11_pkgs += ['xdamage']
-  endif
-  if xfixes_dep.found()
-    x11_pkgs += ['xfixes']
-  endif
-  if xcomposite_dep.found()
-    x11_pkgs += ['xcomposite']
-  endif
-
-  cdata.set('HAVE_XCURSOR', xcursor_dep.found())
-  cdata.set('HAVE_XDAMAGE', xdamage_dep.found())
-  cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found())
-  cdata.set('HAVE_XFIXES', xfixes_dep.found())
+  cdata.set('HAVE_XCURSOR', 1)
+  cdata.set('HAVE_XDAMAGE', 1)
+  cdata.set('HAVE_XCOMPOSITE', 1)
+  cdata.set('HAVE_XFIXES', 1)
 
-  if cc.has_function('XkbQueryExtension', dependencies: x11_dep,
-                     prefix : '#include <X11/XKBlib.h>')
-    cdata.set('HAVE_XKB', 1)
+  if not cc.has_function('XkbQueryExtension', dependencies: x11_dep,
+                         prefix : '#include <X11/XKBlib.h>')
+    error('X11 backend enabled, but Xkb not found.')
   endif
+  cdata.set('HAVE_XKB', 1)
 
-  if cc.has_function('XSyncQueryExtension', dependencies: xext_dep,
-                     prefix: '''#include <X11/Xlib.h>
-                                #include <X11/extensions/sync.h>''')
-    cdata.set('HAVE_XSYNC', 1)
+  if not cc.has_function('XSyncQueryExtension', dependencies: xext_dep,
+                         prefix: '''#include <X11/Xlib.h>
+                                    #include <X11/extensions/sync.h>''')
+    error('X11 backend enabled, but Xsync not found.')
   endif
+  cdata.set('HAVE_XSYNC', 1)
 
-  if cc.has_function('XGetEventData', dependencies: x11_dep)
-    cdata.set('HAVE_XGENERICEVENTS', 1)
+  if not cc.has_function('XGetEventData', dependencies: x11_dep)
+    error('X11 backend enabled, but no generic event support.')
   endif
+  cdata.set('HAVE_XGENERICEVENTS', 1)
 
   if not xi_dep.found() or not cc.has_header('X11/extensions/XInput2.h', dependencies: xi_dep)
     error('X11 backend enabled, but XInput2 not found.')
@@ -549,15 +539,16 @@ if x11_enabled
   has_scroll_class_info = cc.has_member('XIScrollClassInfo', 'number', dependencies: xi_dep,
                                         prefix: '''#include <X11/Xlib.h>
                                                    #include <X11/extensions/XInput2.h>''')
-  if has_allow_touch_events and has_scroll_class_info
-    cdata.set('XINPUT_2_2', 1)
+  if not has_allow_touch_events or not has_scroll_class_info
+    error('X11 backend enabled, but XInput2.2 not found.')
   endif
+  cdata.set('XINPUT_2_2', 1)
 
-  xinerama_dep = dependency('xinerama', required: get_option('xinerama'))
-  if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
-    cdata.set('HAVE_XFREE_XINERAMA', 1)
-    x11_pkgs += ['xinerama']
+  xinerama_dep = dependency('xinerama')
+  if not cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
+    error('X11 backend enabled, but Xinerama extension does not work.')
   endif
+  cdata.set('HAVE_XFREE_XINERAMA', 1)
 
   cdata.set('HAVE_RANDR', xrandr_dep.found())
   cdata.set('HAVE_RANDR15', xrandr15_dep.found())
index 29d186203195135ad4c7193fc7ee9ef851cbc4a3..61878ceba490272025cc3576cf2c9d6f2f024a18 100644 (file)
@@ -53,11 +53,6 @@ option('vulkan',
        value: 'disabled',
        description : 'Enable support for the experimental Vulkan graphics API')
 
-option('xinerama',
-       type: 'feature',
-       value: 'auto',
-       description : 'Enable support for the X11 Xinerama extension')
-
 option('cloudproviders',
        type: 'feature',
        value: 'disabled',